<template>
    <div id="app">
        <div class="content" v-for="A in title">
            <div class="head">
                <h3>
                    {{A.name}}
                </h3>
                <div class="sub" v-for="B in A.children">
                    <a href="javascript:;">{{B.name}}</a>
                </div>
                <a href="#">查看全部<i></i></a>
            </div>
            <div class="box">
                <div class="img">
                    <section>
                        <span>{{A.name}}馆</span>
                        <span>{{A.saleInfo}}</span>
                    </section>
                    <img :src="A.picture" >
                </div>
                <ul>
                    <li v-for="C,index in A.goods" :class="{li_hover:index == tabIndex}"  @mouseover="tabIndex = index" @mouseout="tabIndex = -1" @click="product(C)">
                        <div class="good-item">
                            <img :src="C.picture">
                            <p>{{C.name}}</p>
                            <p>{{C.desc}}</p>
                            <p>￥{{C.price}}</p>
                            <div class="extra" :class="{hover:index == tabIndex}">
                                <span>找相似</span>
                                <span>发现更多宝贝></span>
                            </div>
                        </div>
                    </li>
                </ul>
            </div>
        </div>
    </div>
</template>

<script>
export default {
    name: 'VueProject01Homegoods',
    props:['title'],
    data() {
        return {
            tabIndex:-1
        };
    },

    mounted() {
        
    },

    methods: {
        over($event){
                this.isActive=true
        },
        out(){  
            this.isActive=false
        },
        cli(i){
                // this.isActive=!this.isActive
        },
       product(A){
            this.$router.push({ 
                path:"/product",　　　　
                query:{id:A.id} 
            }) 
        }
    },
};
</script>

<style scoped lang="scss">
.hover{
    bottom: 0 !important;
}
#app{
    width: 100%;
    height: auto;
    background: #fff;
    box-sizing: border-box;
}
.content{
    margin: 0 auto;
    width: 1240px;
    height: 725px;
    .head{
        width: 100%;
        height: 115px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        h3{
            // flex: 1;
            font-size: 32px;
            font-weight: 400;
            margin-left: 6px;
            height: 35px;
            line-height: 35px;
            width: 500px;
            text-align: left;
        }
        .sub{
            display: flex;
            a{
                padding: 2px 12px;
                font-size: 16px;
                border-radius: 4px;
                color: #000;
                &:hover{
                    background: rgb(0, 241, 40);
                    color: #fff;
                }
            }
        }
        a{
            font-size: 16px;
            vertical-align: middle;
            margin-right: 4px;
            color: #999;
            text-decoration: none;
            padding-left: 80px;
            i{
                display: inline-block;
                width: 14px;
                height: 14px;
                font-size: 14px;
                vertical-align: middle;
                position: relative;
                top: 2px;
                color: #ccc;
                margin-bottom: 6px;
                &::before{
                    content: "\e612"
                }
            }
        }
    }
    .box{
        width: 1240px;
        height: 610px;
        display: flex;
        justify-content: space-between;
        .img{
            width: 240px;
            height: 610px;
            position: relative;
            img{
                width: 240px;
                height: 610px;
                object-fit: cover;
            }
            section {
                width: 188px;
                height: 66px;
                display: flex;
                font-size: 18px;
                color: #fff;
                line-height: 66px;
                font-weight: 400;
                position: absolute;
                left: 0;
                top: 50%;

                span {
                    &:nth-of-type(1) {
                        width: 76px;
                        background: rgba(0, 0, 0, .9);
                    }

                    &:nth-of-type(2) {
                        flex: 1;
                        background: rgba(0, 0, 0, .7);
                    }
                }
            }
        }
        ul{
            width: 990px;
            height: 610px;
            display: flex;
            flex-wrap: wrap;
            li{
                box-sizing: border-box;
                width: 240px;
                height: 300px;
                margin-right: 7px;
                margin-bottom: 10px;
                border: 1px solid #FFF;

                &:hover{
                    border: 1px solid #27ba9b;
                }
                .good-item{
                    width: 240px;
                    height: 300px;
                    padding: 10px 30px;
                    box-sizing: border-box;
                    position: relative;
                    overflow: hidden;
                    border: 1px solid transparent;
                    transition: all .5s;
                    img{
                        width: 160px;
                        height: 160px;
                    }
                        p{
                            font-size: 16px;
                            &:nth-of-type(1){
                                width: 178px;
                                margin-top: 6px;
                                color: #333333;
                                white-space: pre-wrap;
                                text-align: left;
                            }
                            &:nth-of-type(2){
                                margin-top: 6px;
                                color: #666666;
                                white-space: nowrap;
                                text-overflow: ellipsis;
                            }
                            &:nth-of-type(3){
                                margin-top: 10px;
                                font-size: 18px;
                                color: #fc4444;
                            }
                        }
                        .extra{
                            position: absolute;
                            bottom: -86px;
                            left: -2px !important;
                            width: 238px;
                            height: 86px;
                            background: #27ba9b;
                            display: flex;
                            flex-direction: column;
                            align-items: center;
                            justify-content: space-around;
                            transition: all linear .3s;
                            hr{
                                width: 60%;
                                border: 1px solid #FFF;
                            }
                            span{
                                font-size: 18px;
                                color: #fff;
                                &:nth-last-child(1){
                                    font-size: 14px;
                                    width: 60%;
                                    border-top: 1px solid #FFF;
                                    padding-top: 11px;
                                }
                            }
                        }
                }
            }
        }
    }
}
</style>